@extends('admin.layout.layout')
@section('content')
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">网站修改</h1>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
    <div class="panel-body">
        <div class="row">
            <div class="col-lg-6 col-lg-offset-3">
            @if (count($errors) > 0)
                <div class="alert alert-danger">
                    <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif
                <button type="submit" id="up" status="1" class="btn btn-primary btn-lg" style="margin-left:90px;width:100px">开启网站</button>
                <button type="submit" id="down" status="2" class="btn btn-primary btn-lg" style="margin-left:90px;width:100px">关闭网站</button>
                </div>
            </div>
        </div>
@endsection
@section('myjs')
<script type="text/javascript">
$('#up').click(function(){
    var status = $(this).attr('status');
    //发送ajax
    $.get('/admin/WZconfig/up',{status:status},function(data){
        if(data == 1){
            alert('前台页面已开启');
        }else{
            alert('前台页面开启失败');
        }
    });
});
$('#down').click(function(){
    var status = $(this).attr('status');
    //发送ajax
    $.get('/admin/WZconfig/down',{status:status},function(data){
        if(data == 1){
            alert('前台页面已关闭');
        }else{
            alert('前台页面关闭失败');
        }
    });
});
</script>
@endsection